
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>filesystem模块 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="rest.html" />
    
    
    <link rel="prev" href="scheduler.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    概要
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.1" data-path="../architecture.html">
            
                <a href="../architecture.html">
            
                    
                    总体架构
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../quick-start.html">
            
                <a href="../quick-start.html">
            
                    
                    快速开始
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../quickstart/confcenter.html">
            
                <a href="../quickstart/confcenter.html">
            
                    
                    配置中心
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../quickstart/oneplatform.html">
            
                <a href="../quickstart/oneplatform.html">
            
                    
                    oneplatform企业级开发平台
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../quickstart/passport.html">
            
                <a href="../quickstart/passport.html">
            
                    
                    统一认证平台
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../jeesuite-lib.html">
            
                <a href="../jeesuite-lib.html">
            
                    
                    jeesuite-libs使用文档
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="common.html">
            
                <a href="common.html">
            
                    
                    common模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="common2.html">
            
                <a href="common2.html">
            
                    
                    common2模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="spring.html">
            
                <a href="spring.html">
            
                    
                    Spring模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="mybatis.html">
            
                <a href="mybatis.html">
            
                    
                    mybatis模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="cache.html">
            
                <a href="cache.html">
            
                    
                    cache模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="kafka.html">
            
                <a href="kafka.html">
            
                    
                    kafka模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="scheduler.html">
            
                <a href="scheduler.html">
            
                    
                    scheduler模块
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.8" data-path="filesystem.html">
            
                <a href="filesystem.html">
            
                    
                    filesystem模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9" data-path="rest.html">
            
                <a href="rest.html">
            
                    
                    restAPI模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10" data-path="springboot-starter.html">
            
                <a href="springboot-starter.html">
            
                    
                    springboot-starter模块
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../integration.html">
            
                <a href="../integration.html">
            
                    
                    系统集成
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../integration/confcenter.html">
            
                <a href="../integration/confcenter.html">
            
                    
                    集成配置中心
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../integration/passport.html">
            
                <a href="../integration/passport.html">
            
                    
                    集成认证中心
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../base-env-install.html">
            
                <a href="../base-env-install.html">
            
                    
                    附：基础环境搭建
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >filesystem模块</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h3 id="&#x529F;&#x80FD;&#x8BF4;&#x660E;">&#x529F;&#x80FD;&#x8BF4;&#x660E;</h3>
<p>&#x6587;&#x4EF6;&#x670D;&#x52A1;&#xFF0C;&#x63D0;&#x4F9B;&#x7EDF;&#x4E00;&#x7684;&#x63A5;&#x53E3;&#xFF0C;&#x76EE;&#x524D;&#x5E95;&#x5C42;&#x63D0;&#x4F9B;&#x4E86;&#x4E03;&#x725B;&#x3001;&#x963F;&#x91CC;&#x4E91;OSS&#x3001;fastdfs&#x4E09;&#x4E2A;&#x6587;&#x4EF6;&#x670D;&#x52A1;&#x5B9E;&#x73B0;&#x3002;</p>
<ul>
<li>&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x81EA;&#x7531;&#x5207;&#x6362;</li>
<li>&#x4E30;&#x5BCC;&#x591A;&#x6837;&#x7684;&#x4E0A;&#x4F20;&#x7C7B;&#x578B;&#xFF1A;&#x6587;&#x4EF6;&#x3001;&#x6587;&#x4EF6;&#x8DEF;&#x5F84;&#x3001;byte[]&#x3001;inputStream&#x7B49;</li>
<li>&#x81EA;&#x52A8;&#x6587;&#x4EF6;&#x7C7B;&#x578B;&#x8BC6;&#x522B;</li>
</ul>
<h3 id="&#x4F7F;&#x7528;&#x8BF4;&#x660E;">&#x4F7F;&#x7528;&#x8BF4;&#x660E;</h3>
<h4 id="&#x6DFB;&#x52A0;&#x4F9D;&#x8D56;">&#x6DFB;&#x52A0;&#x4F9D;&#x8D56;</h4>
<pre><code>&lt;dependency&gt;
    &lt;groupId&gt;com.jeesuite&lt;/groupId&gt;
    &lt;artifactId&gt;jeesuite-filesystem&lt;/artifactId&gt;
    &lt;version&gt;[&#x6700;&#x65B0;&#x7248;&#x672C;]&lt;/version&gt;
&lt;/dependency&gt;

&lt;!--&#x4E03;&#x725B;&#x9700;&#x8981;&#x4F9D;&#x8D56;--&gt;
&lt;dependency&gt;
    &lt;groupId&gt;com.qiniu&lt;/groupId&gt;
    &lt;artifactId&gt;qiniu-java-sdk&lt;/artifactId&gt;
    &lt;version&gt;7.2.2&lt;/version&gt;
&lt;/dependency&gt;

&lt;!--fastDFS&#x9700;&#x8981;&#x4F9D;&#x8D56;--&gt;
&lt;dependency&gt;
  &lt;groupId&gt;io.netty&lt;/groupId&gt;
  &lt;artifactId&gt;netty-all&lt;/artifactId&gt;
  &lt;version&gt;4.0.34.Final&lt;/version&gt;
&lt;/dependency&gt;
&lt;!--&#x963F;&#x91CC;&#x4E91;&#x9700;&#x4F9D;&#x8D56;--&gt;
&lt;dependency&gt;
   &lt;groupId&gt;com.aliyun.oss&lt;/groupId&gt;
   &lt;artifactId&gt;aliyun-sdk-oss&lt;/artifactId&gt;
   &lt;version&gt;2.8.1&lt;/version&gt;
&lt;/dependency&gt;
</code></pre><h4 id="&#x4F7F;&#x7528;">&#x4F7F;&#x7528;</h4>
<h5 id="&#x81EA;&#x5DF1;&#x901A;&#x8FC7;&#x6784;&#x9020;&#x65B9;&#x6CD5;&#x6784;&#x9020;&#x5B9E;&#x4F8B;">&#x81EA;&#x5DF1;&#x901A;&#x8FC7;&#x6784;&#x9020;&#x65B9;&#x6CD5;&#x6784;&#x9020;&#x5B9E;&#x4F8B;</h5>
<pre><code class="lang-java"><span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">test</span><span class="hljs-params">()</span> </span>{
    <span class="hljs-comment">//&#x4E03;&#x725B;</span>
    FSProvider provider = <span class="hljs-keyword">new</span> QiniuProvider(<span class="hljs-string">&quot;http://ovjjqjpmp.bkt.clouddn.com&quot;</span>, <span class="hljs-string">&quot;test&quot;</span>, <span class="hljs-string">&quot;accessKey&quot;</span>, <span class="hljs-string">&quot;secretKey&quot;</span>, <span class="hljs-keyword">true</span>);
    String url = provider.upload(<span class="hljs-keyword">new</span> UploadObject(<span class="hljs-keyword">new</span> File(<span class="hljs-string">&quot;/Users/jiangwei/Desktop/homepage.txt&quot;</span>)));
    provider.downloadAndSaveAs(url, <span class="hljs-string">&quot;/tmp&quot;</span>);
    String downloadUrl = provider.getDownloadUrl(url);
    <span class="hljs-comment">//&#x963F;&#x91CC;&#x4E91;</span>
    provider = <span class="hljs-keyword">new</span> AliyunossProvider(<span class="hljs-string">&quot;http://oss-cn-ghuangzhou.aliyuncs.com&quot;</span>, <span class="hljs-string">&quot;test&quot;</span>, <span class="hljs-string">&quot;accessKey&quot;</span>, <span class="hljs-string">&quot;secretKey&quot;</span>);
    url = provider.upload(<span class="hljs-keyword">new</span> UploadObject(<span class="hljs-keyword">new</span> File(<span class="hljs-string">&quot;/Users/jiangwei/Desktop/homepage.txt&quot;</span>)));
    provider.downloadAndSaveAs(url, <span class="hljs-string">&quot;/tmp&quot;</span>);
    downloadUrl = provider.getDownloadUrl(url);
    <span class="hljs-comment">//fastDFS</span>
    provider = <span class="hljs-keyword">new</span> FdfsProvider(<span class="hljs-string">&quot;http://192.168.1.100:81&quot;</span>, <span class="hljs-string">&quot;fastdfstest&quot;</span>, <span class="hljs-keyword">new</span> String[] {
        <span class="hljs-string">&quot;192.168.1.100:22122&quot;</span>
    },
    <span class="hljs-number">3000</span>, <span class="hljs-number">100</span>);
    url = provider.upload(<span class="hljs-keyword">new</span> UploadObject(<span class="hljs-keyword">new</span> File(<span class="hljs-string">&quot;/Users/jiangwei/Desktop/homepage.txt&quot;</span>)));
    provider.downloadAndSaveAs(url, <span class="hljs-string">&quot;/tmp&quot;</span>);
    downloadUrl = provider.getDownloadUrl(url);
}
</code></pre>
<h5 id="&#x901A;&#x8FC7;&#x5DE5;&#x5382;&#x65B9;&#x6CD5;">&#x901A;&#x8FC7;&#x5DE5;&#x5382;&#x65B9;&#x6CD5;</h5>
<p>&#x914D;&#x7F6E;&#x6587;&#x4EF6;</p>
<pre><code>#&#x6307;&#x5B9A;&#x5168;&#x5C40;&#x7EC4;id &#xFF08;&#x9ED8;&#x8BA4;&#x4E3A;&#xFF1A;public &amp; private&#xFF09;
public.filesystem.id=public
private.filesystem.id=private

#&#x5168;&#x5C40;&#x516C;&#x5171;&#x7A7A;&#x95F4;
public.filesystem.provider=qiniu
public.filesystem.bucketName=test112233
public.filesystem.urlprefix=http://owep828p6.bkt.clouddn.com
public.filesystem.accessKey=iqq3aa-ncqfdGGubCcS-N8EUV-qale2ezndnrtKS
public.filesystem.secretKey=1RmdaMVjrjXkyRVPOmyMa6BzcdG5VDdF-SH_HUTe
public.filesystem.private=false

#&#x5168;&#x5C40;&#x79C1;&#x6709;&#x7A7A;&#x95F4;
private.filesystem.provider=qiniu
private.filesystem.bucketName=testa1b2c3
private.filesystem.urlprefix=http://ovjjqjpmp.bkt.clouddn.com
private.filesystem.accessKey=iqq3aa-ncqfdGGubCcS-N8EUV-qale2ezndnrtKS
private.filesystem.secretKey=1RmdaMVjrjXkyRVPOmyMa6BzcdG5VDdF-SH_HUTe
private.filesystem.private=true

#&#x81EA;&#x5B9A;&#x4E49;&#x7A7A;&#x95F4;
report.filesystem.provider=qiniu
report.filesystem.bucketName=report123
report.filesystem.urlprefix=http://rtjjqrrpmp.bkt.clouddn.com
report.filesystem.accessKey=iqq3aa-ncqfdGGubCcS-N8EUV-qale2ezndnrtKS
report.filesystem.secretKey=1RmdaMVjrjXkyRVPOmyMa6BzcdG5VDdF-SH_HUTe
report.filesystem.private=true

# &#x4F7F;&#x7528;fastdfs
xxxx1.filesystem.provider=fastDFS
xxxx1.filesystem.servers=120.24.185.19:22122
xxxx1.filesystem.urlprefix=http://120.24.185.19:81
xxxx1.filesystem.connectTimeout=3000
xxxx1.filesystem.maxThreads=100

#&#x4F7F;&#x7528;&#x963F;&#x91CC;&#x4E91;
xxxx2.filesystem.provider=aliyun
xxxx2.filesystem.bucketName=aaabb
xxxx2.filesystem.endpoint=http://guangzhou.aliyun.com
xxxx2.filesystem.accessKey=111111
xxxx2.filesystem.secretKey=22222
</code></pre><p>&#x4F7F;&#x7528;</p>
<pre><code class="lang-java"><span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">test</span><span class="hljs-params">()</span> </span>{
   <span class="hljs-comment">//&#x4E0A;&#x4F20;&#x5230;&#x5168;&#x5C40;&#x516C;&#x6709;</span>
   String url = FileSystemClient.getPublicClient().upload(<span class="hljs-keyword">new</span> File(<span class="hljs-string">&quot;/Users/jiangwei/readme.txt&quot;</span>));
   System.out.println(url);

   <span class="hljs-comment">//&#x4E0A;&#x4F20;&#x5230;&#x5168;&#x5C40;&#x79C1;&#x6709;&#x7A7A;&#x95F4;</span>
   url = FileSystemClient.getPrivateClient().upload(<span class="hljs-string">&quot;readme2.txt&quot;</span>, <span class="hljs-keyword">new</span> File(<span class="hljs-string">&quot;/Users/jiangwei/readme.txt&quot;</span>));
   <span class="hljs-comment">//&#x751F;&#x6210;&#x79C1;&#x6709;&#x4E0B;&#x8F7D;&#x94FE;&#x63A5;</span>
   String downloadUrl = FileSystemClient.getPrivateClient().getDownloadUrl(url);

   <span class="hljs-comment">//&#x4E0A;&#x4F20;&#x5230;&#x81EA;&#x5B9A;&#x4E49;&#x7A7A;&#x95F4;</span>
   url = FileSystemClient.getClient(<span class="hljs-string">&quot;report&quot;</span>).upload(<span class="hljs-keyword">new</span> File(<span class="hljs-string">&quot;/Users/jiangwei/report.xls&quot;</span>));
}
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="scheduler.html" class="navigation navigation-prev " aria-label="Previous page: scheduler模块">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="rest.html" class="navigation navigation-next " aria-label="Next page: restAPI模块">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"filesystem模块","level":"1.3.8","depth":2,"next":{"title":"restAPI模块","level":"1.3.9","depth":2,"path":"jeesuite-libs/rest.md","ref":"jeesuite-libs/rest.md","articles":[]},"previous":{"title":"scheduler模块","level":"1.3.7","depth":2,"path":"jeesuite-libs/scheduler.md","ref":"jeesuite-libs/scheduler.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"jeesuite-libs/filesystem.md","mtime":"2017-09-17T04:47:15.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-05-04T10:30:11.187Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

